package feeinterface.protocol.resn;

import org.apache.commons.beanutils.PropertyUtils;
import org.apache.log4j.Logger;

import feeinterface.protocol.utils.Constants;

/**
 * 错误类型
 * 
 * @author 黄杰
 * 
 */
public class ErrorBean {

	private static Logger log = Logger.getLogger(ErrorBean.class);
	/**
	 * 协议编号
	 */
	public String Protocol = "";
	/**
	 * 状态码
	 */
	public Byte Status = Constants.Status.FAIL;
	/**
	 * 错误消息
	 */
	public String Message = "";

	public static Object getErrorBean(String protocolId, String Message) {
	
		// if(protocolId.trim().equals("010005")){
		//
		// }else if()
		try {
			String className = Constants.PROTOCOL_RES_CLASSPATH + protocolId;
			Class cls = Class.forName(className);
			Object errorBean=cls.newInstance();
			PropertyUtils.setProperty(errorBean, "Status", Constants.Status.FAIL);
			PropertyUtils.setProperty(errorBean, "Message", Message);
			return errorBean;
		} catch (Exception e) {
			log.error("", e);
		}
		return null;

		
	}
}
